home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / viewkit / VCal / TimeSlot.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.3 KB  |  78 lines

  1. /*
  2.  * Copyright (C) 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #ifndef _TIME_SLOT_
  18. #define _TIME_SLOT_
  19.  
  20. #include <Vk/VkComponent.h>
  21.  
  22. enum TimeSlotReason { TS_none, TS_textChanged, TS_textCleared, TS_dateSelect,
  23.               TS_traverseForward, TS_traverseBackward };
  24.  
  25. typedef struct {
  26.   class TimeSlot *obj;
  27.   TimeSlotReason reason;
  28. } TimeSlotCallback;
  29.  
  30. class TimeSlot : public VkComponent {
  31. public:
  32.   TimeSlot();
  33.   ~TimeSlot();
  34.  
  35.   virtual const char* className();
  36.   virtual void build(Widget parent);
  37.  
  38.   int start() { return _start; }
  39.   int length() { return _length; }
  40.   void setTimeInterval(int start, int length);
  41.   Boolean dirty() { return _dirty; }
  42.   void setCallback(XtCallbackProc proc, XtPointer client_data);
  43.   void *data() { return _data; }
  44.   void setData(void *d) { _data = d; }
  45.   char *getText();
  46.   void setText(char *str);
  47.   void enableDateSelect();
  48.   void disableDateSelect();
  49.   void afterSwitchScheme();
  50.   void setTextFocus();
  51.  
  52. protected:
  53.   void redisplay();
  54.   void textChanged();
  55.   void dateSelect();
  56.   void traversal(XEvent *event);
  57.  
  58.   static void text_activate(Widget w, XtPointer client_data,
  59.                 XtPointer call_data);
  60.   static void text_focus_lost(Widget w, XtPointer client_data,
  61.                  XtPointer call_data);
  62.   static void text_modify(Widget w, XtPointer client_data,
  63.               XtPointer call_data);
  64.   static void date_select(Widget w, XtPointer client_data,
  65.               XtPointer call_data);
  66.  
  67.   Widget dateButton, text;
  68.   int _start, _length;
  69.   Boolean _dirty;
  70.   XtCallbackProc callback;
  71.   XtPointer callbackData;
  72.   void *_data;
  73.   Boolean dateSelectEnabled;
  74.   Pixel normalBg, dateTop, dateBottom, dateBg, dateArm;
  75. };
  76.  
  77. #endif
  78.